/* 1598. 文件夹操作日志搜集器 */
/**
 * @param {string[]} logs
 * @return {number}
 */
var minOperations = function (logs) {
	const stack = []
	logs.forEach((log) => {
		switch (log) {
			case '../':
				stack.pop()
				break
			case './':
				break
			default:
				stack.push(log)
		}
	})
	return stack.length
}
var minOperations = function (logs) {
	let depth = 0
	for (const log of logs) {
		if ('./' === log) {
			continue
		} else if ('../' === log) {
			if (depth > 0) {
				depth--
			}
		} else {
			depth++
		}
	}
	return depth
}
minOperations(['d1/', 'd2/', '../', 'd21/', './'])
